//
//  WithdrawalExplainViewController.m
//  SameWorld(merchant)
//
//  Created by 李小朋 on 2017/4/2.
//  Copyright © 2017年 杨旭. All rights reserved.
//

#import "WithdrawalExplainViewController.h"
#import <Masonry.h>
@interface WithdrawalExplainViewController ()<UITableViewDelegate ,UITableViewDataSource>
@property (nonatomic ,strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *titleArr;
@property (nonatomic, strong) NSArray *contentArr;
@end

@implementation WithdrawalExplainViewController

- (NSArray *)titleArr {

    if (!_titleArr) {
        self.titleArr = @[@"提现账户?", @"提现到帐日期?", @"工商银行提现?",@"可疑订单的提现?",@"备注"];
    }
    return _titleArr;
}

- (NSArray *)contentArr {

    if (!_contentArr) {
        self.contentArr = @[@"可以选择支付宝、银行卡。", @"两个工作日内，周六、日及法定节假日不处理提现。", @"支持工作日，周末及节假日请走其他通道。受限于银行系统规则，请所有用户及商户仔细核对银行提现帐号，感谢配合。",@"针对订单中出现可疑订单或者违规交易，有权无限期推迟提现周期、以及冻结用户账户及资金，配合相关部门对订单及用户操作行为进行调查。",@"如遇支付平台系统故障或网络故障，提现可能会稍有延迟，敬请谅解。"];

    }
    return _contentArr;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"提现说明";
    self.view.backgroundColor = [UIColor whiteColor];
    [self createTableView];
}

- (void)createTableView {

    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, size_width, size_height) style:UITableViewStylePlain];
    [self.view addSubview:self.tableView];
    self.tableView.backgroundColor = [UIColor colorWithHexString:@"f2f2f2"];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.scrollEnabled = NO;
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    
    self.tableView.estimatedRowHeight = 44;
    self.tableView.rowHeight = UITableViewAutomaticDimension;
    
    UIView *headerView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, size_width, 10))];
    headerView.backgroundColor = [UIColor colorWithHexString:@"f2f2f2"];
    self.tableView.tableHeaderView = headerView;
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 5;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}
#pragma mark -- 返回cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell  *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.textLabel.numberOfLines = -1;
    cell.textLabel.textColor = [UIColor colorWithHexString:@"666666"];
    cell.textLabel.font = [UIFont systemFontOfSize:16];
    cell.textLabel.text = self.contentArr[indexPath.section];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 44;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 10;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size_width, 44)];
    view.backgroundColor = [UIColor whiteColor];
    UIView *lineView = [[UIView alloc] init];
    [view addSubview:lineView];
    lineView.backgroundColor = [UIColor colorWithHexString:@"fe9900"];
    lineView.layer.cornerRadius = 1;
    lineView.layer.masksToBounds = YES;
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(view).with.offset(15);
        make.left.equalTo(view).with.offset(10);
        make.width.mas_equalTo(2);
        make.centerY.mas_equalTo(view);
    }];
    
    UILabel *titleLab = [[UILabel alloc] init];
    [view addSubview:titleLab];
    titleLab.textColor = [UIColor colorWithHexString:@"333333"];
//    titleLab.font = TextName(14);
    titleLab.font = [UIFont systemFontOfSize:14];
    titleLab.textAlignment = NSTextAlignmentLeft;
    titleLab.text = self.titleArr[section];
    
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(lineView).offset(10);
        make.width.equalTo(view).with.multipliedBy(0.6);
        make.centerY.equalTo(view);
        make.height.mas_equalTo(view);
    }];
    
    UIView *bottomLine = [[UIView alloc] init];
    [view addSubview:bottomLine];
    bottomLine.backgroundColor = [UIColor colorWithHexString:@"eeeeee"];
    [bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(view);
        make.height.mas_equalTo(1);
        make.bottom.equalTo(view);
    }];
    
    return view;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UIView *view = [[UIView alloc] init];
    view.backgroundColor = [UIColor clearColor];
    return view;
}

@end
